package com.zqk.pattern.creational.singleton.fanshe;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Package com.zqk.pattern.creational.singleton.fanshe
 * @Description:TODO
 * @Author 张乾坤
 * @Create: 2018/10/26
 * @Version 1.0
 * @Update: message
 */
public class Test {
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class objectClass = HungrySingleton.class;
        Constructor constructor = objectClass.getDeclaredConstructor();
        constructor.setAccessible(true);
        HungrySingleton o = (HungrySingleton) constructor.newInstance();
        HungrySingleton instance = HungrySingleton.getInstance();

        System.out.println(instance);
        System.out.println(o);


    }
}
